<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:70:"/www/wwwroot/mamingwang.cn/yzf/application/admin/view/shop/insert.html";i:1556552365;s:70:"/www/wwwroot/mamingwang.cn/yzf/application/admin/view/common/head.html";i:1556002984;}*/ ?>
<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>聚财国际</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/public/static/css/font.css"> 
	<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon" /> 
    <link rel="stylesheet" href="/public/static/css/xadmin.css">
    <link href="/public/static/lib/layui/css/layui.css" rel="stylesheet">
    <script type="text/javascript" src="/public/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/public/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/public/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script type="text/css">
      #fff{
        border: red solid 1px;
      }
    </script>
  </head>
  
<body>
<div class="x-body">
    <table class="layui-table">
        <thead>
        <th style="text-align: center">添加商户</th>
        </thead>

    </table>
</div>
<form class="layui-form" action="" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">手机号：</label>
        <div class="layui-input-block" STYLE="width: 200px;">
            <input type="text" name="phone" required  lay-verify="phone"  placeholder="请输入手机号" autocomplete="off" class="layui-input"></div>
    </div>
    <div class="layui-form-item">
        <label for="username" class="layui-form-label">
            <span class="x-red"></span>密码：
        </label>
        <div class="layui-input-inline">
            <input type="password" id="L_pass" name="u_pwd"  lay-verify="pass"
                   autocomplete="off" placeholder="请输入登录密码" class="layui-input" >
        </div>
    </div>
    <div class="layui-form-item">
        <label for="username" class="layui-form-label">
            <span class="x-red"></span>确认密码：
        </label>
        <div class="layui-input-inline">
            <input type="password" id="L_repass" name="repwd"  lay-verify="repass"
                   autocomplete="off" placeholder="请再次输入登录密码" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商户名称：</label>
        <div class="layui-input-block" STYLE="width: 200px;">
            <input type="text" name="username" required  lay-verify="required"  placeholder="请输入商户名" autocomplete="off" class="layui-input"></div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="add">立即提交</button>
        </div>
    </div>
    </div>
</form>

<script>
    layui.use(['laydate','form'], function() {
        var laydate = layui.laydate;
        //执行一个laydate实例
        var form = layui.form
            ,layer = layui.layer;
        //自定义验证规则
        form.verify({
            nikename: function(value){
                if(value.length <6 || value.length>10){
                    return '密码位数错误！';
                }
            }
            ,pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,repass: function(value){
                if($('#L_pass').val()!=$('#L_repass').val()){
                    return '两次密码不一致';
                }
            }
        });


        //监听提交
        form.on('submit(add)', function(data){
            console.log(data);
            var url="";
            $.ajax({
                type: "post",
                async:false,
                url: "<?php echo url('admin/shop/insert'); ?>",
                data: data.field,
                success:function (res) {
                    if(res==1){
                        layer.msg("添加成功！");
                        setTimeout(function () {
                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            window.parent.location.reload();//刷新父级窗口
                        }, 2000);
                    }
                    else if(res==2)
                    {
                        layer.msg("手机号重复");
                    }else {
                        layer.msg("添加失败");
                    }
                }
            })
            //发异步，把数据提交给php
            //layer.alert("增加成功", {icon: 6},function () {
            // 获得frame索引
            //var index = parent.layer.getFrameIndex(window.name);
            //关闭当前frame
            // parent.layer.close(index);
            //  });
            return false;
        });

    });
</script>
<script>
    function banner_edit(obj){
        var mid=$(obj).attr('attr_id');
        //alert(mid);
        var url="<?php echo Url('admin/user/chakan'); ?>?uid="+  mid;
        // alert(url);
        x_admin_show('查看',url);
    }
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });


    /*用户-删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            //发异步删除数据
            $(obj).parents("tr").remove();
            layer.msg('已删除!',{icon:1,time:1000});
        });
    }
</script>

</body>

</html>